package com.google.gwt.sample.stockwatcher.server;

import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.remoting.WebRemote;

import com.google.gwt.sample.stockwatcher.client.api.DelistedException;
import com.google.gwt.sample.stockwatcher.client.api.StockPrice;
import com.google.gwt.sample.stockwatcher.client.api.StockPriceService;

/**
 * <p>Implementation of interface <code>com.google.gwt.sample.stockwatcher.client.StockPriceService</code>.</p>
 * <p>The component name must match the name of implemented interface.</p>
 * 
 * @author dearshor
 *
 */
@Name("com.google.gwt.sample.stockwatcher.client.api.StockPriceService")
public class StockPriceServiceImpl  implements
		StockPriceService {


	@In("priceService") StockPriceService sps;

	@WebRemote
	public StockPrice[] getPrices(String[] symbols) throws DelistedException {
		
		try {
			return sps.getPrices(symbols);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new RuntimeException("There is no available service. Waiting for services...",e);
		}

	}

}
